package com.ecube.utils;

import com.ecube.protocol.common.ProtocolFunction;

/**
 * @author zhuweijun
 * @version 1.0.0
 * @since 2025/7/31 13:30
 */
public class EnumUtils {

    /**
     * 获取类注解枚举类
     *
     * @param clazz clazz
     * @return {@link Enum<?>}
     */
    public static Enum<?> getFunction(Class<?> clazz) {
        ProtocolFunction annotation = clazz.getAnnotation(ProtocolFunction.class);
        if(annotation == null){
            return null;
        }
        return Enum.valueOf((Class<? extends Enum>)annotation.type(), annotation.value());
    }

}
